﻿using ConfExpert.Forms.Base;
using ConfExpert.Utility;
using System;
using System.Threading;

namespace ConfExpert.Forms.Depo
{
    public partial class GPIO : XRFID
    {
        public GPIO()
        {
            InitializeComponent();
        }

        private void GPIO_Load(object sender, EventArgs e)
        {
            cb4.CheckedChanged += new EventHandler(cb4_CheckedChanged);
            cb3.CheckedChanged += new EventHandler(cb3_CheckedChanged);
            cb2.CheckedChanged += new EventHandler(cb2_CheckedChanged);
            cb1.CheckedChanged += new EventHandler(cb1_CheckedChanged);

            StartReader(AppSession.GateIP, Org.LLRP.LTK.LLRPV1.Impinj.ENUM_ImpinjInventorySearchType.Single_Target_With_Suppression);
        }

        void cb1_CheckedChanged(object sender, EventArgs e)
        {
            Set_GPO_State(1, cb1.Checked);
        }

        void cb2_CheckedChanged(object sender, EventArgs e)
        {
            Set_GPO_State(2, cb2.Checked);
        }

        void cb3_CheckedChanged(object sender, EventArgs e)
        {
            Set_GPO_State(3, cb3.Checked);
        }

        void cb4_CheckedChanged(object sender, EventArgs e)
        {
            Set_GPO_State(4, cb4.Checked);
            if (cb4.Checked)
            {
                Thread.Sleep(3000);
                cb4.Checked = false;
            }
        }

    }
}